package com.atguigu.tingshu.album.testlock;

import com.atguigu.tingshu.album.testlock.service.TestService;
import com.atguigu.tingshu.common.result.Result;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/album/test")
public class TestController {

    //  注入服务层方法
    @Autowired
    private TestService testService;

    /**
     * 测试分布式锁
     * @return
     */
    @SneakyThrows
    @GetMapping("testLock")
    public Result testLock(){
        testService.testLock2();
        return Result.ok();
    }
}
